* {
  margin: 0;
  padding: 0;
}

ul {
  position: relative;
  left: 25%;
  margin-top: 200px;
}


ul li {
  float: left;
  margin-right: 20px;
  width: 120px;
  height: 35px;
  /* transform-style: preserve-3d; */
  list-style: none;
  perspective: 500px;
}

.box {
  position: relative;
  width: 100%;
  height: 100%;
  transition: all .5s;
  transform-style: preserve-3d;
}

.a,
.b {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: pink;
  text-align: center;
  line-height: 40px;
}

.a {
  z-index: 1;
  transform: translateZ(17.5px);
}

.b {
  background-color: blueviolet;
  /* 如果有移动  或者其他样式 移动要写在最前面 */
  transform: translateY(17.5px) rotateX(-90deg);

}

.box:hover {
  transform: rotateX(90deg);
}